#tag Module
Protected Module ColorExtends
	#tag Method, Flags = &h0
		Function X11name(Extends c As Color, allowBlanks As Boolean = true) As String
		  Static Dict as Dictionary
		  if dict is nil then
		    dict = new Dictionary
		    Dict.Value( &c000000 ) = "Black"
		    Dict.Value( &c000080 ) = "Navy"
		    Dict.Value( &c00008B ) = "DarkBlue"
		    Dict.Value( &c0000CD ) = "MediumBlue"
		    Dict.Value( &c0000FF ) = "Blue"
		    Dict.Value( &c006400 ) = "DarkGreen"
		    Dict.Value( &c008000 ) = "Green"
		    Dict.Value( &c008080 ) = "Teal"
		    Dict.Value( &c008B8B ) = "DarkCyan"
		    Dict.Value( &c00BFFF ) = "DeepSkyBlue"
		    Dict.Value( &c00CED1 ) = "DarkTurquoise"
		    Dict.Value( &c00FA9A ) = "MediumSpringGreen"
		    Dict.Value( &c00FF00 ) = "Lime"
		    Dict.Value( &c00FF7F ) = "SpringGreen"
		    Dict.Value( &c00FFFF ) = "Aqua"
		    Dict.Value( &c00FFFF ) = "Cyan"
		    Dict.Value( &c191970 ) = "MidnightBlue"
		    Dict.Value( &c1E90FF ) = "DodgerBlue"
		    Dict.Value( &c20B2AA ) = "LightSeaGreen"
		    Dict.Value( &c228B22 ) = "ForestGreen"
		    Dict.Value( &c2E8B57 ) = "SeaGreen"
		    Dict.Value( &c2F4F4F ) = "DarkSlateGray"
		    Dict.Value( &c32CD32 ) = "LimeGreen"
		    Dict.Value( &c3CB371 ) = "MediumSeaGreen"
		    Dict.Value( &c40E0D0 ) = "Turquoise"
		    Dict.Value( &c4169E1 ) = "RoyalBlue"
		    Dict.Value( &c4682B4 ) = "SteelBlue"
		    Dict.Value( &c483D8B ) = "DarkSlateBlue"
		    Dict.Value( &c48D1CC ) = "MediumTurquoise"
		    Dict.Value( &c4B0082 ) = "Indigo"
		    Dict.Value( &c556B2F ) = "DarkOliveGreen"
		    Dict.Value( &c5F9EA0 ) = "CadetBlue"
		    Dict.Value( &c6495ED ) = "CornflowerBlue"
		    Dict.Value( &c66CDAA ) = "MediumAquamarine"
		    Dict.Value( &c696969 ) = "DimGray"
		    Dict.Value( &c6A5ACD ) = "SlateBlue"
		    Dict.Value( &c6B8E23 ) = "OliveDrab"
		    Dict.Value( &c708090 ) = "SlateGray"
		    Dict.Value( &c778899 ) = "LightSlateGray"
		    Dict.Value( &c7B68EE ) = "MediumSlateBlue"
		    Dict.Value( &c7CFC00 ) = "LawnGreen"
		    Dict.Value( &c7FFF00 ) = "Chartreuse"
		    Dict.Value( &c7FFFD4 ) = "Aquamarine"
		    Dict.Value( &c800000 ) = "Maroon"
		    Dict.Value( &c800080 ) = "Purple"
		    Dict.Value( &c808000 ) = "Olive"
		    Dict.Value( &c808080 ) = "Gray"
		    Dict.Value( &c87CEEB ) = "SkyBlue"
		    Dict.Value( &c87CEFA ) = "LightSkyBlue"
		    Dict.Value( &c8A2BE2 ) = "BlueViolet"
		    Dict.Value( &c8B0000 ) = "DarkRed"
		    Dict.Value( &c8B008B ) = "DarkMagenta"
		    Dict.Value( &c8B4513 ) = "SaddleBrown"
		    Dict.Value( &c8FBC8F ) = "DarkSeaGreen"
		    Dict.Value( &c90EE90 ) = "LightGreen"
		    Dict.Value( &c9370DB ) = "MediumPurple"
		    Dict.Value( &c9400D3 ) = "DarkViolet"
		    Dict.Value( &c98FB98 ) = "PaleGreen"
		    Dict.Value( &c9932CC ) = "DarkOrchid"
		    Dict.Value( &c9ACD32 ) = "YellowGreen"
		    Dict.Value( &cA0522D ) = "Sienna"
		    Dict.Value( &cA52A2A ) = "Brown"
		    Dict.Value( &cA9A9A9 ) = "DarkGray"
		    Dict.Value( &cADD8E6 ) = "LightBlue"
		    Dict.Value( &cADFF2F ) = "GreenYellow"
		    Dict.Value( &cAFEEEE ) = "PaleTurquoise"
		    Dict.Value( &cB0C4DE ) = "LightSteelBlue"
		    Dict.Value( &cB0E0E6 ) = "PowderBlue"
		    Dict.Value( &cB22222 ) = "FireBrick"
		    Dict.Value( &cB8860B ) = "DarkGoldenrod"
		    Dict.Value( &cBA55D3 ) = "MediumOrchid"
		    Dict.Value( &cBC8F8F ) = "RosyBrown"
		    Dict.Value( &cBDB76B ) = "DarkKhaki"
		    Dict.Value( &cC0C0C0 ) = "Silver"
		    Dict.Value( &cC71585 ) = "MediumVioletRed"
		    Dict.Value( &cCD5C5C ) = "IndianRed"
		    Dict.Value( &cCD853F ) = "Peru"
		    Dict.Value( &cD2691E ) = "Chocolate"
		    Dict.Value( &cD2B48C ) = "Tan"
		    Dict.Value( &cD3D3D3 ) = "LightGrey"
		    Dict.Value( &cD8BFD8 ) = "Thistle"
		    Dict.Value( &cDA70D6 ) = "Orchid"
		    Dict.Value( &cDAA520 ) = "Goldenrod"
		    Dict.Value( &cDB7093 ) = "PaleVioletRed"
		    Dict.Value( &cDC143C ) = "Crimson"
		    Dict.Value( &cDCDCDC ) = "Gainsboro"
		    Dict.Value( &cDDA0DD ) = "Plum"
		    Dict.Value( &cDEB887 ) = "BurlyWood"
		    Dict.Value( &cE0FFFF ) = "LightCyan"
		    Dict.Value( &cE6E6FA ) = "Lavender"
		    Dict.Value( &cE9967A ) = "DarkSalmon"
		    Dict.Value( &cEE82EE ) = "Violet"
		    Dict.Value( &cEEE8AA ) = "PaleGoldenrod"
		    Dict.Value( &cF08080 ) = "LightCoral"
		    Dict.Value( &cF0E68C ) = "Khaki"
		    Dict.Value( &cF0F8FF ) = "AliceBlue"
		    Dict.Value( &cF0FFF0 ) = "Honeydew"
		    Dict.Value( &cF0FFFF ) = "Azure"
		    Dict.Value( &cF4A460 ) = "SandyBrown"
		    Dict.Value( &cF5DEB3 ) = "Wheat"
		    Dict.Value( &cF5F5DC ) = "Beige"
		    Dict.Value( &cF5F5F5 ) = "WhiteSmoke"
		    Dict.Value( &cF5FFFA ) = "MintCream"
		    Dict.Value( &cF8F8FF ) = "GhostWhite"
		    Dict.Value( &cFA8072 ) = "Salmon"
		    Dict.Value( &cFAEBD7 ) = "AntiqueWhite"
		    Dict.Value( &cFAF0E6 ) = "Linen"
		    Dict.Value( &cFAFAD2 ) = "LightGoldenrodYellow"
		    Dict.Value( &cFDF5E6 ) = "OldLace"
		    Dict.Value( &cFF0000 ) = "Red"
		    Dict.Value( &cFF00FF ) = "Magenta"
		    Dict.Value( &cFF00FF ) = "Fuchsia"
		    Dict.Value( &cFF1493 ) = "DeepPink"
		    Dict.Value( &cFF4500 ) = "OrangeRed"
		    Dict.Value( &cFF6347 ) = "Tomato"
		    Dict.Value( &cFF69B4 ) = "HotPink"
		    Dict.Value( &cFF7F50 ) = "Coral"
		    Dict.Value( &cFF8C00 ) = "DarkOrange"
		    Dict.Value( &cFFA07A ) = "LightSalmon"
		    Dict.Value( &cFFA07A ) = "LightSalmon"
		    Dict.Value( &cFFA500 ) = "Orange"
		    Dict.Value( &cFFB6C1 ) = "LightPink"
		    Dict.Value( &cFFC0CB ) = "Pink"
		    Dict.Value( &cFFD700 ) = "Gold"
		    Dict.Value( &cFFDAB9 ) = "PeachPuff"
		    Dict.Value( &cFFDEAD ) = "NavajoWhite"
		    Dict.Value( &cFFE4B5 ) = "Moccasin"
		    Dict.Value( &cFFE4C4 ) = "Bisque"
		    Dict.Value( &cFFE4E1 ) = "MistyRose"
		    Dict.Value( &cFFEBCD ) = "BlanchedAlmond"
		    Dict.Value( &cFFEFD5 ) = "PapayaWhip"
		    Dict.Value( &cFFF0F5 ) = "LavenderBlush"
		    Dict.Value( &cFFF5EE ) = "Seashell"
		    Dict.Value( &cFFF8DC ) = "Cornsilk"
		    Dict.Value( &cFFFACD ) = "LemonChiffon"
		    Dict.Value( &cFFFAF0 ) = "FloralWhite"
		    Dict.Value( &cFFFAFA ) = "Snow"
		    Dict.Value( &cFFFF00 ) = "Yellow"
		    Dict.Value( &cFFFFE0 ) = "LightYellow"
		    Dict.Value( &cFFFFF0 ) = "Ivory"
		    Dict.Value( &cFFFFFF ) = "White"
		  end if
		  Dim retval as String
		  retval = dict.Lookup( c, "" )
		  If retval = ""  and allowBlanks = false then
		    dim v as Variant
		    v = c
		    retval = mid( v.StringValue, 3 )
		  End If
		  Return retval
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1
		Protected Function X11Colour(Name As String, DefaultColour as Color = &c000000) As Color
		  if mX11Colour is nil then
		    mX11Colour = new Dictionary
		    mX11Colour.Value( "Black" ) = &c000000
		    mX11Colour.Value( "Navy" ) = &c000080
		    mX11Colour.Value( "DarkBlue" ) = &c00008B
		    mX11Colour.Value( "MediumBlue" ) = &c0000CD
		    mX11Colour.Value( "Blue" ) = &c0000FF
		    mX11Colour.Value( "DarkGreen" ) = &c006400
		    mX11Colour.Value( "Green" ) = &c008000
		    mX11Colour.Value( "Teal" ) = &c008080
		    mX11Colour.Value( "DarkCyan" ) = &c008B8B
		    mX11Colour.Value( "DeepSkyBlue" ) = &c00BFFF
		    mX11Colour.Value( "DarkTurquoise" ) = &c00CED1
		    mX11Colour.Value( "MediumSpringGreen" ) = &c00FA9A
		    mX11Colour.Value( "Lime" ) = &c00FF00
		    mX11Colour.Value( "SpringGreen" ) = &c00FF7F
		    mX11Colour.Value( "Aqua" ) = &c00FFFF
		    mX11Colour.Value( "Cyan" ) = &c00FFFF
		    mX11Colour.Value( "MidnightBlue" ) = &c191970
		    mX11Colour.Value( "DodgerBlue" ) = &c1E90FF
		    mX11Colour.Value( "LightSeaGreen" ) = &c20B2AA
		    mX11Colour.Value( "ForestGreen" ) = &c228B22
		    mX11Colour.Value( "SeaGreen" ) = &c2E8B57
		    mX11Colour.Value( "DarkSlateGray" ) = &c2F4F4F
		    mX11Colour.Value( "LimeGreen" ) = &c32CD32
		    mX11Colour.Value( "MediumSeaGreen" ) = &c3CB371
		    mX11Colour.Value( "Turquoise" ) = &c40E0D0
		    mX11Colour.Value( "RoyalBlue" ) = &c4169E1
		    mX11Colour.Value( "SteelBlue" ) = &c4682B4
		    mX11Colour.Value( "DarkSlateBlue" ) = &c483D8B
		    mX11Colour.Value( "MediumTurquoise" ) = &c48D1CC
		    mX11Colour.Value( "Indigo" ) = &c4B0082
		    mX11Colour.Value( "DarkOliveGreen" ) = &c556B2F
		    mX11Colour.Value( "CadetBlue" ) = &c5F9EA0
		    mX11Colour.Value( "CornflowerBlue" ) = &c6495ED
		    mX11Colour.Value( "MediumAquamarine" ) = &c66CDAA
		    mX11Colour.Value( "DimGray" ) = &c696969
		    mX11Colour.Value( "SlateBlue" ) = &c6A5ACD
		    mX11Colour.Value( "OliveDrab" ) = &c6B8E23
		    mX11Colour.Value( "SlateGray" ) = &c708090
		    mX11Colour.Value( "LightSlateGray" ) = &c778899
		    mX11Colour.Value( "MediumSlateBlue" ) = &c7B68EE
		    mX11Colour.Value( "LawnGreen" ) = &c7CFC00
		    mX11Colour.Value( "Chartreuse" ) = &c7FFF00
		    mX11Colour.Value( "Aquamarine" ) = &c7FFFD4
		    mX11Colour.Value( "Maroon" ) = &c800000
		    mX11Colour.Value( "Purple" ) = &c800080
		    mX11Colour.Value( "Olive" ) = &c808000
		    mX11Colour.Value( "Gray" ) = &c808080
		    mX11Colour.Value( "SkyBlue" ) = &c87CEEB
		    mX11Colour.Value( "LightSkyBlue" ) = &c87CEFA
		    mX11Colour.Value( "BlueViolet" ) = &c8A2BE2
		    mX11Colour.Value( "DarkRed" ) = &c8B0000
		    mX11Colour.Value( "DarkMagenta" ) = &c8B008B
		    mX11Colour.Value( "SaddleBrown" ) = &c8B4513
		    mX11Colour.Value( "DarkSeaGreen" ) = &c8FBC8F
		    mX11Colour.Value( "LightGreen" ) = &c90EE90
		    mX11Colour.Value( "MediumPurple" ) = &c9370DB
		    mX11Colour.Value( "DarkViolet" ) = &c9400D3
		    mX11Colour.Value( "PaleGreen" ) = &c98FB98
		    mX11Colour.Value( "DarkOrchid" ) = &c9932CC
		    mX11Colour.Value( "YellowGreen" ) = &c9ACD32
		    mX11Colour.Value( "Sienna" ) = &cA0522D
		    mX11Colour.Value( "Brown" ) = &cA52A2A
		    mX11Colour.Value( "DarkGray" ) = &cA9A9A9
		    mX11Colour.Value( "LightBlue" ) = &cADD8E6
		    mX11Colour.Value( "GreenYellow" ) = &cADFF2F
		    mX11Colour.Value( "PaleTurquoise" ) = &cAFEEEE
		    mX11Colour.Value( "LightSteelBlue" ) = &cB0C4DE
		    mX11Colour.Value( "PowderBlue" ) = &cB0E0E6
		    mX11Colour.Value( "FireBrick" ) = &cB22222
		    mX11Colour.Value( "DarkGoldenrod" ) = &cB8860B
		    mX11Colour.Value( "MediumOrchid" ) = &cBA55D3
		    mX11Colour.Value( "RosyBrown" ) = &cBC8F8F
		    mX11Colour.Value( "DarkKhaki" ) = &cBDB76B
		    mX11Colour.Value( "Silver" ) = &cC0C0C0
		    mX11Colour.Value( "MediumVioletRed" ) = &cC71585
		    mX11Colour.Value( "IndianRed" ) = &cCD5C5C
		    mX11Colour.Value( "Peru" ) = &cCD853F
		    mX11Colour.Value( "Chocolate" ) = &cD2691E
		    mX11Colour.Value( "Tan" ) = &cD2B48C
		    mX11Colour.Value( "LightGrey" ) = &cD3D3D3
		    mX11Colour.Value( "Thistle" ) = &cD8BFD8
		    mX11Colour.Value( "Orchid" ) = &cDA70D6
		    mX11Colour.Value( "Goldenrod" ) = &cDAA520
		    mX11Colour.Value( "PaleVioletRed" ) = &cDB7093
		    mX11Colour.Value( "Crimson" ) = &cDC143C
		    mX11Colour.Value( "Gainsboro" ) = &cDCDCDC
		    mX11Colour.Value( "Plum" ) = &cDDA0DD
		    mX11Colour.Value( "BurlyWood" ) = &cDEB887
		    mX11Colour.Value( "LightCyan" ) = &cE0FFFF
		    mX11Colour.Value( "Lavender" ) = &cE6E6FA
		    mX11Colour.Value( "DarkSalmon" ) = &cE9967A
		    mX11Colour.Value( "Violet" ) = &cEE82EE
		    mX11Colour.Value( "PaleGoldenrod" ) = &cEEE8AA
		    mX11Colour.Value( "LightCoral" ) = &cF08080
		    mX11Colour.Value( "Khaki" ) = &cF0E68C
		    mX11Colour.Value( "AliceBlue" ) = &cF0F8FF
		    mX11Colour.Value( "Honeydew" ) = &cF0FFF0
		    mX11Colour.Value( "Azure" ) = &cF0FFFF
		    mX11Colour.Value( "SandyBrown" ) = &cF4A460
		    mX11Colour.Value( "Wheat" ) = &cF5DEB3
		    mX11Colour.Value( "Beige" ) = &cF5F5DC
		    mX11Colour.Value( "WhiteSmoke" ) = &cF5F5F5
		    mX11Colour.Value( "MintCream" ) = &cF5FFFA
		    mX11Colour.Value( "GhostWhite" ) = &cF8F8FF
		    mX11Colour.Value( "Salmon" ) = &cFA8072
		    mX11Colour.Value( "AntiqueWhite" ) = &cFAEBD7
		    mX11Colour.Value( "Linen" ) = &cFAF0E6
		    mX11Colour.Value( "LightGoldenrodYellow" ) = &cFAFAD2
		    mX11Colour.Value( "OldLace" ) = &cFDF5E6
		    mX11Colour.Value( "Red" ) = &cFF0000
		    mX11Colour.Value( "Magenta" ) = &cFF00FF
		    mX11Colour.Value( "Fuchsia" ) = &cFF00FF
		    mX11Colour.Value( "DeepPink" ) = &cFF1493
		    mX11Colour.Value( "OrangeRed" ) = &cFF4500
		    mX11Colour.Value( "Tomato" ) = &cFF6347
		    mX11Colour.Value( "HotPink" ) = &cFF69B4
		    mX11Colour.Value( "Coral" ) = &cFF7F50
		    mX11Colour.Value( "DarkOrange" ) = &cFF8C00
		    mX11Colour.Value( "LightSalmon" ) = &cFFA07A
		    mX11Colour.Value( "LightSalmon" ) = &cFFA07A
		    mX11Colour.Value( "Orange" ) = &cFFA500
		    mX11Colour.Value( "LightPink" ) = &cFFB6C1
		    mX11Colour.Value( "Pink" ) = &cFFC0CB
		    mX11Colour.Value( "Gold" ) = &cFFD700
		    mX11Colour.Value( "PeachPuff" ) = &cFFDAB9
		    mX11Colour.Value( "NavajoWhite" ) = &cFFDEAD
		    mX11Colour.Value( "Moccasin" ) = &cFFE4B5
		    mX11Colour.Value( "Bisque" ) = &cFFE4C4
		    mX11Colour.Value( "MistyRose" ) = &cFFE4E1
		    mX11Colour.Value( "BlanchedAlmond" ) = &cFFEBCD
		    mX11Colour.Value( "PapayaWhip" ) = &cFFEFD5
		    mX11Colour.Value( "LavenderBlush" ) = &cFFF0F5
		    mX11Colour.Value( "Seashell" ) = &cFFF5EE
		    mX11Colour.Value( "Cornsilk" ) = &cFFF8DC
		    mX11Colour.Value( "LemonChiffon" ) = &cFFFACD
		    mX11Colour.Value( "FloralWhite" ) = &cFFFAF0
		    mX11Colour.Value( "Snow" ) = &cFFFAFA
		    mX11Colour.Value( "Yellow" ) = &cFFFF00
		    mX11Colour.Value( "LightYellow" ) = &cFFFFE0
		    mX11Colour.Value( "Ivory" ) = &cFFFFF0
		    mX11Colour.Value( "White" ) = &cFFFFFF
		  end if
		  return mX11Colour.Lookup( Name , DefaultColour )
		End Function
	#tag EndMethod


	#tag Property, Flags = &h21
		Private mX11Colour As Dictionary
	#tag EndProperty


	#tag ViewBehavior
		#tag ViewProperty
			Name="Name"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Index"
			Visible=true
			Group="ID"
			InitialValue="-2147483648"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Super"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Left"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Top"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
	#tag EndViewBehavior
End Module
#tag EndModule
